package com.joplus.housekeeper.ui.view.dialog;

import android.app.Dialog;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;

import com.joplus.housekeeper.R;


/**
 * Created by sc on 2015/10/29.
 */
public class LoadingDialog {

    private Dialog dialog;

    private CircularProgressView circularProgressView;

    public LoadingDialog(Context context) {
        dialog = new Dialog(context, R.style.pragress_style);
        View view = LayoutInflater.from(context).inflate(R.layout.progress, null);
        circularProgressView = (CircularProgressView) view.findViewById(R.id.progress_view);
        dialog.setContentView(view);
        dialog.setCanceledOnTouchOutside(false);
    }

    public void show() {
        if (dialog != null && circularProgressView != null) {
            dialog.show();
            circularProgressView.startAnimation();
        }
    }

    public void dismiss() {
        if (dialog != null ) {
            dialog.dismiss();
        }
    }


}
